home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 001 / pibt40s1.arc / ADJUSTHR.MOD next >
Text File  |  1987-03-26  |  2KB  |  40 lines

  1. (*--------------------------------------------------------------------------*)
  2. (*        Adjust_Hour --- Convert 24 hour time to 12 hour am/pm             *)
  3. (*--------------------------------------------------------------------------*)
  4.  
  5. PROCEDURE Adjust_Hour( VAR Hour : INTEGER;
  6.                        VAR AmPm : ShortStr );
  7.  
  8. (*----------------------------------------------------------------------*)
  9. (*                                                                      *)
  10. (*    Procedure: Adjust_Hour                                            *)
  11. (*                                                                      *)
  12. (*    Purpose:   Converts 24 hour time to 12 hour am/pm time            *)
  13. (*                                                                      *)
  14. (*    Calling sequence:                                                 *)
  15. (*                                                                      *)
  16. (*       Adjust_Hour( VAR Hour : INTEGER; AmPm : ShortStr );            *)
  17. (*                                                                      *)
  18. (*          Hour --- Input = Hours in 24 hour form;                     *)
  19. (*                   Output = Hours in 12 hour form.                    *)
  20. (*          AmPm --- Output 'am' or 'pm' indicator                      *)
  21. (*                                                                      *)
  22. (*----------------------------------------------------------------------*)
  23.  
  24. BEGIN (* Adjust_Hour *)
  25.  
  26.    IF ( Hour < 12 ) THEN
  27.       BEGIN
  28.          AmPm := 'am';
  29.          IF ( Hour = 0 ) THEN
  30.             Hour := 12;
  31.       END
  32.    ELSE
  33.       BEGIN
  34.          AmPm := 'pm';
  35.          IF ( Hour <> 12 ) THEN
  36.             Hour := Hour - 12;
  37.       END;
  38.  
  39. END   (* Adjust_Hour *);
  40.